﻿using System;
using System.Reflection;
using Loki.Utils;
using Luna.Data.Test;
using NUnit.Framework;

[SetUpFixture]
public class TestSetup
{
    private const string logFile = "Luna.Data.Test.log4net.config";
    private SqlCeTestDataModel sqlCeModel = new SqlCeTestDataModel();
    private SqlServerTestDataModel sqlServerModel = new SqlServerTestDataModel();

    [TearDown]
    public void Clean()
    {
        sqlServerModel.Clean();
        ToolKit.Reset();
    }

    [SetUp]
    public void Initialize()
    {
        try
        {
            // Initialize Data engine
            ToolKit.Logger.Configure(Assembly.GetExecutingAssembly().GetManifestResourceStream(logFile));
            ToolKit.Logger.GetLogger("").Debug("test log");
            ToolKit.Engine.DefineDataModel(sqlServerModel);

            sqlServerModel.Initialize();
        }
        catch (Exception ex)
        {
            Console.Out.WriteLine(ex.Message);
        }
    }
}